<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div>
            <textarea name="" id="" cols="30" rows="10" v-model="ipt"></textarea>
            <button @click="add">发布</button>
        </div>
        <div v-for="(item,index) in taxt">
            <span>{{item.ipt}} {{item.time}} {{item.num}}</span>
            <button @click="a(index)">点赞</button>
            <button @click="b(index)">置顶</button>
            <button @click="c(index)">删除</button>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                ipt: '',
                taxt: [],
                time:'11-5',
                num:0
            },
            methods: {
                add() {
                  let obj ={
                      ipt:this.ipt,
                      num:this.num,
                      time:this.time
                  }
                  this.taxt.push(obj)
                  this.ipt='';
                },
                a(i){
                    ++this.taxt[i].num
                },
                b(i){
                    this.taxt.unshift(this.taxt[i])
                    this.taxt.splice(i+1,1)
                    console.log(this.taxt);
                },
                c(i){
                    this.taxt.splice(i,1)
                }
            }
        })
    </script>
</body>

</html>